function login() {
    let loginName =  $("#loginName").val();
    if(!loginName){
        alert("账号不能为空！");
        return;
    }
    let password = $("#password").val();
    if(!password){
        alert("密码不能为空！");
        return;
    }
    $.ajax({
        url: "/api/system/login/login",
        data: JSON.stringify({
            "loginName": loginName,
            "password": password
        }),
        contentType: 'application/json',
        type: "POST",
        dataType: "json",
        success: function (json) {
            if(json.code === 200){
                setUser(loginName);
                window.location.href="/api/web/page/chatroom/index";
            }else{
                alert(json.message);
            }
        },
        error: function () {
            alert("提交失败");
        }
    })
}